<!DOCTYPE html>
<html
        xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        layout:decorate="shixi/include/layout_blank">
<head>
    <meta charset="UTF-8">
    <title>用户登入</title>
    <style>

    </style>
</head>
<body>
    <div class="content" layout:fragment="content">
        <div style="height: 100vh;" class="row align-items-center m-auto justify-content-center">
            <div class="border" style="width:420px;">
                <form style="margin:20px">
                    <div class="form-group">
                        <label for="username">用户名</label>
                        <input type="text" required class="form-control" id="username" name="loginName">
                    </div>
                    <div class="form-group">
                        <label for="password">密码</label>
                        <input type="password" required class="form-control" id="password" name="password">
                    </div>
                    <button type="button" class="btn btn-primary btn-block">登入</button>
                </form>
            </div>
        </div>
        <script>
            $(function(){
                $("button").on("click",function(){
                    var data = getFormData($("form"))
                    login(data,function(data){
                        if(data.code===0){
                            redirect("/")
                        }
                    })
                })
            })
        </script>
    </div>
</body>
</html>